import React, { Component } from 'react';
import {
    Image,
    Animated
} from 'react-native';


export default class AniImage extends Component {

    constructor(props) {
        super(props);
        this.state = {
            
        };
    }
    render() {
        const {styles, uri} = this.props;
        this.animatedValue = new Animated.Value(1);
        const imgAnimation = this.animatedValue.interpolate({
            inputRange: [0, 100],
            outputRange: [0, 1]
        })
        return (
            <Animated.Image
                onLoadEnd={() => {
                    Animated.timing(this.animatedValue, {
                        toValue: 100,
                        duration: 200
                    }).start()
                }}
                source={{uri}}
                style={[styles, {opacity: imgAnimation}]}
            />
        );
    }
    
}